package kevin.framework.basic.common.xls;

import java.util.HashMap;
import java.util.Map;

import org.apache.poi.hssf.usermodel.HSSFCellStyle;

/**
 * @ClassName: CellStyleCache
 * @Description: xls单元格样式缓存，解决一个xls不能创建超过4000个CellStyle的问题
 * @author kevin.huang
 * @date 2016-1-22 下午5:21:46
 */
public class CellStyleCache {
	private Map<String, HSSFCellStyle> mapCache;

	public CellStyleCache() {
		mapCache = new HashMap<String, HSSFCellStyle>();
	}

	public HSSFCellStyle getStyle(String key) {
		return mapCache.get(key);
	}

	public void setStyle(String key, HSSFCellStyle style) {
		mapCache.put(key, style);
	}

	public void clear() {
		mapCache.clear();
		mapCache = null;
	}
}
